package com.hc.model.code03.test7;

/**
 * @version v1.0
 * @ClassName: MenuItem
 * @Description: 菜单类（属于叶子节点）
 * @Author: HC
 */
public class MenuItem extends MenuComponent{
    private String name;
    private int level;

    public MenuItem(String name, int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 0; i < level; i++) {
            System.out.print("--");
        }
        System.out.println(name);
    }
}
